﻿#include <memory>

struct PluginConcept
{
    virtual ~PluginConcept() {}
    virtual void doSomething() = 0;
};

template <typename T>
struct PluginModel : PluginConcept
{
    PluginModel(const T &t) : data(t) {}
    void doSomething() override
    {
        data.doSomething();
    }
    T data;
};

class Plugin
{
public:
    template <typename T>
    Plugin(const T &t) : data(std::make_unique<PluginModel<T>>(t)) {}

    void doSomething()
    {
        data->doSomething();
    }

private:
    std::unique_ptr<PluginConcept> data;
};